<!DOCTYPE HTML>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0, minimum-scale=1.0, user-scalable=0, initial-scale=1.0, width=device-width" />
    <meta name="format-detection" content="telephone=no, email=no, date=no, address=no">
    <title>工单计划物料</title>
    <link rel="stylesheet" type="text/css" href="../css/mui.min.css" />
    <link rel="stylesheet" type="text/css" href="../css/common.css"/>
	<style type="text/css">
    	.detail{
    		padding-right: 20px!important;
    	}
    	h5{color: #0062CC;}
    </style>
</head>

<body>
    <div class="mui-content" id="mui-content">
  		<!-- 模板引擎 -->
    </div>
</body>
<script type="text/javascript" src="../script/api.js"></script>
<script src="../script/mui.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../script/common.js" type="text/javascript" charset="utf-8"></script>
<script src="../script/template.js" type="text/javascript" charset="utf-8"></script>
<script id="tmpList" type="text/template">
    {{each datas as item}}
      <div class="mui-card">
        <ul class="mui-table-view mui-table-view-chevron">
          <li class="mui-table-view-cell mui-collapse">
            <a class="mui-navigate-right" href="#">任务序号：{{item.tasksequence}}
              <span class="mui-badge mui-badge-inverted">SGMW ID:{{item.itemnum}}</span>
            </a>
            <ul class="mui-table-view mui-table-view-chevron">
              <li class="mui-table-view-cell">数量：{{item.itemqty}}</li>
              <li class="mui-table-view-cell">单位成本：{{item.unitcost}}</li>
              <li class="mui-table-view-cell">行成本：{{item.linecost}}</li>
              <li class="mui-table-view-cell">库房：{{item.location}}</li>
              {{if item.directreq == 0}}
              <li  class="mui-table-view-cell">是否直接发放：否</li>
              {{else}}
              <li  class="mui-table-view-cell">是否直接发放：是</li>
              {{/if}}
              <li class="mui-table-view-cell">描述：{{item.description}}</li>
            </ul>
          </li>
        </ul>
        <div class="mui-card-footer">
          <a class="mui-card-link" tapmode onclick="openSaveWin('work_order_manage_sthPlan_edit', '修改计划物料', {wpitemid:{{item.wpitemid}},wonum: api.pageParam.wonum,linetype: api.pageParam.linetype})">修改计划物料</a>
          <a class="mui-card-link"></a>
          <a class="mui-card-link" tapmode onclick="Delete('deletePlanMaterial',{wpitemid:{{item.wpitemid}}})">删除</a>
        </div>
      </div>
    {{/each}}
</script>
<script type="text/javascript">
	apiready = function () {
    onLoadData(curPage,false)
    scrollToBottomHandler(function() {
        if (!loadEnd) { // 没有结束时继续加载
            curPage++;
            onLoadData(curPage, true);
        } else { // 告诉到底了
            EndToast('到底了');
        }
    })
    Refresh(function() {
        loadEnd = false;
        curPage = 1;
        onLoadData(curPage, false);
    });
    api.addEventListener({
            name: 'refersh'
    }, function(ret, err) {
    	if (ret.value.isrefersh == 'yes') {
    		tjsearch();
    	}
    });
		api.addEventListener({
		    name:'navitembtn'
		},function(ret, err){
		    if(ret.type == 'right'){
		    	openSaveWin('work_order_manage_sthPlan_add','添加计划物料',{
		        	linetype: api.pageParam.linetype,
		        	wonum: api.pageParam.wonum
		        })
		    }
	  })
    api.parseTapmode();
	}
  function onLoadData (page,load) {
    ajaxrd("queryPlanMaterialList",{
    	wonum: api.pageParam.wonum,
        pageNo: page,
        pageSize: 10
    },function(data){
    	api.refreshHeaderLoadDone();
      AddData('tmpList','mui-content', data.list, load);
    })
  }
</script>

</html>
